﻿
--转正审批
CREATE proc [dbo].[proc_Employee_ProbationPassed_Audit]
(
	@Id int,
	@Audit bit,
	@Memo text,
	@UserName nvarchar (50),
	@IsInsured int,
	@AuditTime nvarchar(50)

)
as
		begin
			declare @eid int,@ZzDate datetime,@GradeId int
			set @eid = (select eid from Employee_ProbationPassed where id=@id)
			set @ZzDate = (select ZzDate from Employee_ProbationPassed where id=@id)
			set @GradeId = (select GradeId from Employee_ProbationPassed where id=@id)
			
			update Employee_ProbationPassed set Audit=@Audit,Memo=@Memo,AuditPerson=@UserName,AuditTime=@AuditTime where id=@id
			--审批通过，员工状态变为4(正式)
			
			if(@audit=1)
				update employee set State=4,ZzDate=@ZzDate,GradeId=@GradeId,IsInsured =@IsInsured  where id=@eid
		
		Select @eid as 'RETUNR_V'
		end
RETURN